package com.mjlf.hometeach.common.db.assit;

import com.mjlf.hometeach.common.db.provider.assit.GradeProvider;
import com.mjlf.hometeach.common.entity.assit.Grade;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @auther a123
 * @create 2018-05-05 18:16
 * @desc 年级与数据库交互
 */
@Mapper
public interface GradeDAO {

    /**
     * 添加年级
     * @param grade
     * @return
     */
    @InsertProvider(type = GradeProvider.class, method = "save")
    @Options(useGeneratedKeys = true)
    int save(Grade grade);

    /**
     * 根据id删除年级分类
     * @param gradeId
     * @return
     */
    @DeleteProvider(type = GradeProvider.class, method = "deleteById")
    int deleteById(@Param("id") Integer gradeId);


    /**
     * 获取所有年级分类
     * @return
     */
    @SelectProvider(type = GradeProvider.class, method = "listAllGrade")
    List<Grade> listAllGrade();
}
